Skip to content

Conversation

@task-jp
Copy link
Contributor

@task-jp task-jp commented Nov 17, 2025

Add explicit 8-byte alignment to SharedVectorHeader on both Rust and C++ sides to fix layout corruption on ARM Cortex-M7 (32-bit).

Without explicit alignment, the struct has 4-byte natural alignment on ARM32, but pointer arithmetic calculations differ between Rust and C++, causing a 4-byte offset when accessing SharedVector data. This corrupts all layout calculations (HorizontalLayout, VerticalLayout, GridLayout) and makes Slint unusable on ARM32 embedded platforms.

The fix adds alignas(8) to C++ and #[repr(C, align(8))] to Rust, ensuring consistent struct layout across the FFI boundary on all platforms.

Fixes: #10097

Add explicit 8-byte alignment to SharedVectorHeader on both Rust
and C++ sides to fix layout corruption on ARM Cortex-M7 (32-bit).

Without explicit alignment, the struct has 4-byte natural alignment
on ARM32, but pointer arithmetic calculations differ between Rust
and C++, causing a 4-byte offset when accessing SharedVector data.
This corrupts all layout calculations (HorizontalLayout, VerticalLayout,
GridLayout) and makes Slint unusable on ARM32 embedded platforms.

The fix adds alignas(8) to C++ and #[repr(C, align(8))] to Rust,
ensuring consistent struct layout across the FFI boundary on all
platforms.

Fixes: slint-ui#10097
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SharedVector ABI Mismatch on ARM Cortex-M7 Breaks All Layouts

1 participant